/**
 * Mixin AjaxContentLoader
 * 
 * Used to "mixin" with other classes.
 * Provides methods for updating an element with contents from any Url
 * 
 * @author David Lindkvist (david.lindkvist@shapeshift.se)
 */
PWF.mixin.AjaxContentLoader = {
		
	loadContent: function(/*String*/containerId, /*String*/sourceUrl) {

		//clear old widget contents
		$(containerId).update('');

		//process before load
		this.onLoadInit();

		//load content
		new Ajax.Updater(containerId, 
						 sourceUrl, 
						 { 
							method: 'get',
							onComplete: this.onLoadSuccess.bind(this),
							onException: this.onLoadError.bind(this)
						 });	
	},
	onLoadInit: function() {	
		//override me pls!
	},
	onLoadSuccess: function() {
		//override me pls!
	},
	onLoadError: function() {
		//override me pls!
	}
};